package com.tyk.bookstore.back.system.model.vo;

import com.tyk.bookstore.back.common.core.model.page.PageVo;
import com.tyk.bookstore.back.common.core.model.type.Gender;
import com.tyk.bookstore.back.common.core.util.FileUtil;
import com.tyk.bookstore.back.system.model.type.UserState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

public class UserPageVo extends PageVo<UserPageVo.User> {

    @Data
    public static class User {
        @Schema(description = "用户年龄", requiredMode = Schema.RequiredMode.REQUIRED)
        private Integer age;

        @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED)
        private String avatar;

        @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED)
        private String account;

        @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
        private LocalDateTime createTime;

        @Schema(description = "电子邮箱", requiredMode = Schema.RequiredMode.REQUIRED)
        private String email;

        @Schema(description = "用户性别：0男，1女", requiredMode = Schema.RequiredMode.REQUIRED, type = "integer")
        private Gender gender;

        @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
        private String id;

        @Schema(description = "身份证号", requiredMode = Schema.RequiredMode.REQUIRED)
        private String idCard;

        @Schema(description = "用户姓名", requiredMode = Schema.RequiredMode.REQUIRED)
        private String name;

        @Schema(description = "电话号码", requiredMode = Schema.RequiredMode.REQUIRED)
        private String phone;

        @Schema(description = "用户状态：0可用，1禁用，2已注销", requiredMode = Schema.RequiredMode.REQUIRED, type = "integer")
        private UserState state;


        public User setAvatar(String avatar) {
            this.avatar = FileUtil.fullFilePath(avatar);
            return this;
        }
    }
}
